﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Text;
using System.Windows.Forms;
using System.Drawing;

namespace Gui.Controls.ExtendedTabControl
{
    public partial class MetalExtendedTab : UserControl
    {
        #region Members

        private int menuIndex = 0;

        #endregion

        #region Constructor

        public MetalExtendedTab()
        {
            InitializeComponent();
            TabMasksLoader.Parent = this;
        }

        #endregion

        public void AddPage(string text, string containerURI)
        {
            string loaded = ";false";
            TabMasksLoader.TabbedMasks.Add(containerURI + loaded);
            TabMasksLoader.MasksNames.Add(string.Empty);

            TabMenu newMenu = new TabMenu();
            newMenu.Name += menuIndex;
            newMenu.SetTextMenu = text;

            newMenu.Top = newMenu.Height * menuIndex;

            this.MenuPanel.BackColor = TabMenuStyle.MenuBackColor;
            newMenu.MenuIndex = menuIndex;

            this.MenuPanel.Controls.Add(newMenu);

            menuIndex++;
        }

        public void ShowPage(int index)
        {
            this.MenuPanel.Controls["TabMenu" + index].ForeColor = TabMenuStyle.MenuForeColorSelected;
            this.MenuPanel.Controls["TabMenu" + index].BackColor = TabMenuStyle.MenuBackColorSelected;
            (this.MenuPanel.Controls["TabMenu" + index] as TabMenu).Selected = true;
            TabMasksLoader.ShowTab(index);
        }
    }
}
